package com.example.mvp.ui.activity;
import com.example.mvp.presenter.BasePresenter;
import com.example.mvp.view.BaseView;

public abstract class BaseMvpActivity<V extends BaseView,P extends BasePresenter<V>> extends BaseActivity {

   public P mPresenter;

    @Override
    protected void initData() {
        mPresenter=createPresenter();
        if (mPresenter!=null){
            mPresenter.bindView((V)this);
        }
        initEvent();

    }

    protected abstract void initEvent();


    protected abstract P createPresenter();


    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mPresenter!=null){
            mPresenter.destoryView();
            mPresenter=null;
        }
    }
}
